package com.xayy.health.core.enums;

import lombok.Getter;

/**
 * 权限设置
 *
 * @author Shichenlei
 */
public enum RoleEnum {
    //所有权限
    ALL(1,"所有权限"),
    //只读权限
    READ(2,"只读权限"),;

    @Getter
    private Integer code;

    @Getter
    private String name;

    RoleEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 获取所拥有权限详情
     *
     * @param index 索引
     * @return String
     */
    public static String valueof(Integer index){
        for (RoleEnum labelEnum:values()){
            if (labelEnum.getCode().equals(index)) {
                return labelEnum.name;
            }
        }
        return "";
    }
}
